<?php

namespace App\Validate\Admin;

use App\Http\Request;

class Goods extends Request
{
    /**
     * 验证规则
     */
    protected $rule = [
        'goods_id' => 'required|numeric',
        'cate_id' => 'required|numeric',
        'brand_id' => 'required|numeric',
        'goods_sn' => 'required',
        'title' => 'required',
        'spec_type' => 'required',
        'supply_price' => 'required',
        'line_price' => 'required',
        'image' => 'required',
        'thumb_image' => 'required',
        'images' => 'required',
        'details' => 'required',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'goods_id.required' => '请选择商品',
        'cate_id.required' => '请选择商品分类',
        'brand_id.required' => '请选择商品品牌',
        'goods_sn.required' => '请输入商品编码',
        'title.required' => '请输入商品标题',
        'spec_type.required' => '请选择规格类型',
        'supply_price.required' => '请输入供货价',
        'line_price.required' => '请输入划线价',
        'image.required' => '请上传商品主图',
        'thumb_image.required' => '请上传商品缩略图',
        'images.required' => '请上传商品轮播图',
        'details.required' => '请输入商品详情',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add_goods' => ['cate_id', 'brand_id', 'goods_sn', 'title', 'spec_type', 'image', 'images', 'details'],
        'edit_goods' => ['goods_id', 'cate_id', 'brand_id', 'goods_sn', 'title', 'spec_type', 'image', 'images', 'details'],
    ];
}
